import { defineStore } from "pinia";

interface ITab{
    titel: string,
    path: string,
    isActive: boolean
}

const useTabsStore = defineStore("tabs", {
    state(){
        return {
            tabs:[
                {
                    titel: '总览',
                    path: '/totalview',
                    isActive: false
                },
            ]
        };
    },
    actions:{
        // 添加当前访问的tab
        addTab(tab:ITab){
            const isExist = this.tabs.some(item => item.path === tab.path);
            if(!isExist){
                this.tabs.push(tab);
            }
        }
    }
})